package com.common.web.dataset.description;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.common.web.dataset.vo.ColsVO;
import com.common.web.dataset.vo.RowsVO;

/**
 * DataSet描述
 * @author lj
 * @date 2016年12月13日15:48:31
 *
 */
public class DataSetDescription extends RowsVO{
	
	private String idAttr;
	
	private Set<String> names = new HashSet<String>();
	
	private List<DataFieldDescription> dataFieldDescriptions = new ArrayList<DataFieldDescription>();
	
	public String getIdAttr() {
		return idAttr;
	}
	public void setIdAttr(String idAttr) {
		this.idAttr = idAttr;
	}
	
	public void addName(String name) {
		names.add(name);
	}
	
	public void addDataFieldDescription(DataFieldDescription filedDescription) {
		this.dataFieldDescriptions.add(filedDescription);
	}
	
	public Set<String> getNames() {
		return names;
	}
	public void setNames(Set<String> names) {
		this.names = names;
	}
	
	public List<DataFieldDescription> getDataFieldDescriptions() {
		return dataFieldDescriptions;
	}
	
	public void setDataFieldDescriptions(List<DataFieldDescription> dataFieldDescriptions) {
		this.dataFieldDescriptions = dataFieldDescriptions;
	}

	public List<ColsVO> toDataSetColList(String name){
		List<ColsVO> list = new ArrayList<ColsVO>();
		for(int i=0;i<dataFieldDescriptions.size();i++){
			list.add(dataFieldDescriptions.get(i).toCols(name));
		}
		return list;
	}
	
	@Override
	public String toString() {
		return "DataSetDescription [names=" + names
				+ ", dataFieldDescriptions=" + dataFieldDescriptions + "]";
	}

}
